import { captureConsole, actionPlugin } from '@apmplus/integrations'
import Apmplus from '@apmplus/web'

const initAction = () => {
  Apmplus.init({
    aid: 0,
    token: '',
    pid: 'main',
    domain: 'cypress.test',
    integrations: [actionPlugin()],
  })
}

const initConsole = () => {
  Apmplus.init({
    aid: 0,
    token: '',
    pid: 'main',
    domain: 'cypress.test',
    integrations: [captureConsole({ levels: ['error'] })],
  })
}

export const TriggerIntegration = () => {
  return (
    <>
      <button id="init-action" onClick={initAction}>
        init-action
      </button>
      <button id="init-console" onClick={initConsole}>
        init-console
      </button>
    </>
  )
}
